from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time

# ActionChains 鼠标操作


driver = webdriver.Edge()

url = "https://www.baidu.com/"

driver.get(url)

# driver.maximize_window()

action = ActionChains(driver)

# driver.find_element(By.ID,"kw").send_keys("美女")

# 鼠标右键
# action.context_click(driver.find_element(By.ID,"su"))

# 鼠标左键
# action.click(driver.find_element(By.ID,"su"))

# 鼠标悬停
# action.move_to_element(driver.find_element(By.CLASS_NAME,"soutu-btn"))

action.perform()

time.sleep(5)
driver.quit()